function interpolate(value,list_values) {
    var interpolate_value;
    var properties = new Array();
    var i = 0;
    for (var a in list_values){
        properties[i] = a;
        i = i+1;
    }
    for (i=0; i<properties.length; i++){//Only for positive numbers
        if (value == properties[i]) {
            return list_values[value];
            break;
        }
			else if (value > properties[i] && value < properties[i+1]){
            interpolate_value = list_values[properties[i]] - ((properties[i] - value)*((list_values[properties[i]] - list_values[properties[i+1]]) / (properties[i] - properties[i+1])));
			break;
			}
            else if (value < properties[i] && value > properties[i+1]) {
			interpolate_value = list_values[properties[i]] - ((properties[i] - value)*((list_values[properties[i]] - list_values[properties[i+1]]) / (properties[i] - properties[i+1])));
			break;
			}
			//alert(properties[i]);
            //alert(properties[i+1]);
            //alert(list_values[properties[i+1]]);
            //alert(list_values[properties[i]]);
            //alert(interpolate_value); 	
				else {
				interpolate_value = 0
				}
    }
	return interpolate_value;
	}

 